package org.dromara.system.controller.system;

import io.swagger.v3.oas.annotations.tags.Tag;
import org.dromara.common.core.domain.R;
import org.dromara.common.web.core.BaseController;
import org.dromara.system.domain.vo.TestUserOrderVo;
import org.dromara.system.service.ITestUserService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 *  测试用户多租户
 *
 * @author: gxp
 * @desc: todo
 * @create: 2024-09-05 17:40
 **/
@RestController
@RequestMapping("/testTenant")
@ConditionalOnProperty(value = "tenant.enable", havingValue = "true")
public class TestUserController extends BaseController {
     @Resource
     private ITestUserService testUserService;

     /**
      * 查询租户下的用户订单
      * @return
      */
     @GetMapping("/listOrders")
    public R<List<TestUserOrderVo>> test() {
          List<TestUserOrderVo> ll=testUserService.selectOrderList();
          return R.ok(ll);
    }

    @GetMapping("/listAllOrders/{userId}")
    public R<List<TestUserOrderVo>> listAllOrdersByUserId(@PathVariable("userId") Long userId) {
        List<TestUserOrderVo> ll=testUserService.listAllOrderByUserId(userId);
        return R.ok(ll);
    }
}
